<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	template="page.xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:archer="http://java.sun.com/jsf/archer"
	xmlns:pm="http://primefaces.org/mobile"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:sec="http://www.springframework.org/security/facelets/tags"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:of="http://omnifaces.org/functions"
	xmlns:o="http://omnifaces.org/ui">
	<f:metadata>
<!-- 		<f:viewParam name="path" value="#{sessionScope.goBack}"></f:viewParam> -->
	</f:metadata>
	<ui:define name="content">
		<ui:param name="path" value="#{request.contextPath}"></ui:param>
		<h:outputScript library="primefaces" name="jquery/jquery.js"
			target="head" />
		<ui:fragment
			rendered="#{configHome.getConfigValue('enable_mobile_site') eq '1'}">
			<script type="text/javascript" charset="utf-8">
				//<![CDATA[
				if (!!navigator.userAgent.match(/Mobile/)) {
					location.href = "#{path}/memberLoginMobile";
				}
				//]]>
			</script>


		</ui:fragment>
		<!--展开隐藏-->
		<SCRIPT type="text/javascript">
			function show_div() {
				var obj_div = document.getElementById("serachShow");
				obj_div.style.display = (obj_div.style.display == 'none') ? ''
						: 'none';
				var img = document.getElementById("more");
				if (obj_div.style.display == "none") {
					img.src = "#{tplVars.themeImagePath}/images/bb.png";
				} else {
					img.src = "#{tplVars.themeImagePath}/images/bt.png";
				}
			}
		</SCRIPT>
		<script type="text/javascript"
			src="#{tplVars.themeJSPath}/jquery.artDialog.js?skin=idialog"></script>
		<script type="text/javascript"
			src="#{tplVars.themeJSPath}/jquery.SuperSlide.2.1.1.js"></script>
		<script type="text/javascript" src="#{tplVars.themeJSPath}/common.js"></script>
		<script type="text/javascript" src="#{tplVars.themeJSPath}/Base64.js"></script>

		<link rel="stylesheet" href="#{tplVars.themeStylePath}/css/layout.css"
			media="all" />
		<link rel="stylesheet" href="#{tplVars.themeStylePath}/css/zhan.css"
			media="all" />
		<script type="text/javascript">
			/**
			用户名密码Base64加密后台MyAuthenticationManager解密
			 */
			$(function() {
				$("#butt").click(function() {
					var name = $("#username").val();
					if (name == "") {
						return;
					}
					var nameB64 = base64encode(utf16to8(name));
					$("#j_username").val(nameB64);
					//alert(nameB64);
					var pass = $("#password").val();
					if (pass == "") {
						return;
					}
					var passB64 = base64encode(utf16to8(pass));
					$("#j_password").val(passB64);
					//alert(passB64);
					$("#form").submit();
				});
			});
		</script>
		<!--正文内容调用-->
		<div class="con_box bg">
			<f:event type="preRenderComponent" listener="#{loginUtil.setSession('loginType','login')}"></f:event>
			<ui:fragment
				rendered="#{not empty request.getParameter('spring-security-redirect')}">
				<input type="hidden" name="spring-security-redirect"
					value="#{request.getParameter('spring-security-redirect')}"></input>
			</ui:fragment>

			<div class="w ">
				<form action="#{request.contextPath}/memberLogin"
					accept-charset="UTF-8" method="post" id="form">
					<h:inputText id="j_username" style="display:none" />
					<h:inputText id="j_password" style="display:none" />
					<h:inputText id="encrypt" value="encrypt" style="display:none" />
					<img class="sign_banner"
						src="#{tplVars.themeImagePath}/images/sign_banner.png" />
					<dl class="sign_box">
						<dt class="Black_t s24">欢迎登录</dt>
						<dd>
							<span class="sign_box_dt">登录:</span>
							<h:inputText id="username" type="text" class="login_txt"
								maxlength="60" />
							<p:watermark value="请输入用户名/手机号/邮箱" for="username"></p:watermark>
						</dd>
						<dd>
							<span class="sign_box_dt">密码:</span>
							<h:inputSecret id="password" type="text" class="login_txt"
								maxlength="16" />
							<p:watermark value="请输入密码" for="password"></p:watermark>
						</dd>
						<ui:fragment
							rendered="#{sessionScope.need_validate_code or configHome.getConfigValue('login_fail_max_times') eq '0'}">
							<dd>
								<span class="sign_box_dt">验证码:</span>
								<h:inputText id="captcha_input" maxlength="4"
									styleClass="login_txt1 fl"></h:inputText>
								<p:watermark value="请输入验证码" for="captcha_input"></p:watermark>
								<a class="fl" style="margin-top:10px;" href="javascript:void(0)"><img
									alt="点击刷新" id="verifyCode"
									src="#{request.contextPath}/verifyCodeServlet"
									onclick="this.src='#{request.contextPath}/verifyCodeServlet?'+new Date().getTime()" /></a>
							</dd>
						</ui:fragment>
						<dd>

							<input type="submit" class="red_btn-big"
								style="margin-left:115px;" value="立即登录" id="butt" />
						</dd>
						<div class="clear"></div>
						<div class="check_box">
							<input name="_spring_security_remember_me" type="checkbox"
								class="check" /> 下次自动登录 <a
								href="#{request.contextPath}/find_login-password">忘记密码？</a>丨<a
								href="#{request.contextPath}/register">免费注册</a>
						</div>
					</dl>
				</form>
			</div>

		</div>
		<ui:fragment
			rendered="#{not empty requestScope['SPRING_SECURITY_LAST_EXCEPTION'] and requestScope['SPRING_SECURITY_LAST_EXCEPTION'].message ne 'Authentication method not supported: GET'}">
			<script>
				$.dialog.tips('#{requestScope['SPRING_SECURITY_LAST_EXCEPTION'].message}', 2);
			</script>
		</ui:fragment>
	</ui:define>
</ui:composition>
